#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>

int main(){
    char buf[4096];
    int n;
    int fd = open("pic.png", O_RDONLY);
    lseek(fd, 0, SEEK_SET);
    int fd1 = open("cp.png", O_WRONLY | O_TRUNC);
    lseek(fd1, 0, SEEK_SET);
    while((n = read(fd, buf, 4096)) != 0){
        write(fd1, buf, n);
    }

    return 0;

}